<template>
  <div class="profile-container">
    <!-- 用户信息卡片 -->
    <!-- <div class="profile-card">
      <div class="profile-header">
        <div class="avatar-container">
          <img class="avatar" src="@/assets/images/public/user-head.png" alt="User Avatar">
          <div class="level-badge">v{{ userInfo.level }}</div>
        </div>
        <div class="profile-info">
          <h2 class="username">{{ userInfo.username }}</h2>
          <p class="user-id">ID: {{ userInfo.id }}</p>
        </div>
      </div>

      <div class="profile-details">
        <div class="detail-row">
          <div class="detail-item">
            <span class="detail-label">{{ $t('user.email') }}</span>
            <span class="detail-value">{{ userInfo.email }}</span>
          </div>
        </div>
      </div>
    </div> -->

    <!-- 设置选项 -->
    <div class="settings-panel">
      <div class="setting-item">
        <div class="setting-icon">
          <img src="@/assets/images/icons/icon_lock.png" />
        </div>
        <div class="setting-content">
          <h3 class="setting-title">{{ $t('user.changingLoginPassword') }}</h3>
          <p class="setting-description">{{ $t('user.passwordLength') }}</p>
        </div>
        <div class="setting-action">
          <router-link to="changing/password">
            <Button type="primary" ghost>Change Passwaord</Button>
          </router-link>
        </div>
      </div>

      <div class="setting-item" v-if="false">
        <div class="setting-icon">
          <Icon type="ios-mail" size="24" />
        </div>
        <div class="setting-content">
          <h3 class="setting-title">{{ $t('user.changeEmail') }}</h3>
          <p class="setting-description">{{ $t('user.hintEmail') }}</p>
        </div>
        <div class="setting-action">
          <router-link to="changing/email">
            <Button type="primary" shape="circle" icon="ios-arrow-forward"></Button>
          </router-link>
        </div>
      </div>

      <div class="setting-item" v-if="false">
        <div class="setting-icon">
          <Icon type="ios-time" size="24" />
        </div>
        <div class="setting-content">
          <h3 class="setting-title">最近登录记录</h3>
          <p class="setting-description">123.146.70.49 PC 2023-11-25 17:14:56</p>
        </div>
        <div class="setting-action">
          <router-link to="login/record">
            <Button type="primary" shape="circle" icon="ios-arrow-forward"></Button>
          </router-link>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from "vuex";

export default {
  name: "user-info",
  data() {
    return {
      modal1: false,
      valueText: 3,
      valueCustomText: 3.8
    }
  },
  computed: {
    ...mapState({
      userInfo: state => state.user.userInfo
    })
  },
}
</script>

<style scoped lang="less">
.profile-container {
  width: 100%;
  margin: 0 auto;
}

.profile-card {
  background: linear-gradient(135deg, #6e8efb, #a777e3);
  border-radius: 12px;
  padding: 30px;
  color: white;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(30deg);
  }
}

.profile-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
}

.avatar-container {
  position: relative;
  margin-right: 20px;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
  object-fit: cover;
}

.level-badge {
  position: absolute;
  bottom: -5px;
  right: -5px;
  background: #ff4757;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  border: 2px solid white;
}

.profile-info {
  .username {
    font-size: 24px;
    margin: 0;
    font-weight: 600;
  }

  .user-id {
    font-size: 14px;
    opacity: 0.8;
    margin: 5px 0 0;
  }
}

.profile-details {
  position: relative;
  z-index: 2;
}

.detail-row {
  display: flex;
  flex-wrap: wrap;
}

.detail-item {
  margin-right: 30px;
  margin-bottom: 10px;

  .detail-label {
    display: block;
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 5px;
  }

  .detail-value {
    font-size: 16px;
    font-weight: 500;
  }
}

.settings-panel {
  background: white;
  border-radius: 12px;
  overflow: hidden;
}

.setting-item {
  display: flex;
  align-items: center;
  padding: 20px 30px;
  transition: all 0.3s ease;

  border-radius: 8px;
  border: 1px solid #F1F1F1;

}

.setting-icon {
  margin-right: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;

  img {
    width: 40px;
    height: 40px;
  }
}

.setting-content {
  flex: 1;

  .setting-title {
    margin: 0;
    font-size: 16px;
    color: #333;
    font-weight: 500;
  }

  .setting-description {
    margin: 5px 0 0;
    font-size: 12px;
    color: #969696;
  }
}

.setting-action {
  margin-left: 15px;
}

@media (max-width: 768px) {
  .profile-card {
    padding: 20px;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
  }

  .avatar-container {
    margin-right: 0;
    margin-bottom: 15px;
  }

  .detail-row {
    justify-content: center;
  }

  .detail-item {
    margin-right: 15px;
    text-align: center;
  }
}
</style>